<script>
import { Login } from '@/api/syy';
export default {
  data() {
    return {
      phone: '',
      password: '',
    };
  },
  methods: {
    onSubmit(values) {
      console.log('submit', values.phone);
      Login({ phone: values.phone, password: values.password }).then((res) => {
        console.log(res)
      })
    },
  },
};
</script>

<template>
  <div>
    <h1>登录</h1>
    <van-form @submit="onSubmit">
      <van-field v-model="phone" name="phone" label="用户名:" placeholder="请输入用户名"
        :rules="[{ required: true, message: '请填写用户名' }]" />
      <van-field v-model="password" type="password" name="password" label="密码:" placeholder="请输入用户密码"
        :rules="[{ required: true, message: '请填写密码' }]" />
      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit" color="rgb(254,77,40)">登录</van-button>
        <!-- <van-button round block type="info" native-type="submit">注册</van-button> -->
      </div>
    </van-form>
  </div>
</template>

<style scoped lang="less">
h1 {
  font-size: 30px;
  font-weight: bold;
  text-align: center;
  line-height: 90px;
}
</style>
